import React, { useImperativeHandle, useRef } from 'react'
import { Select as SelectAnt } from 'antd'

const Select = React.forwardRef((props, ref) => {
  const { children, ...restProps } = props

  const inputRef = useRef()

  useImperativeHandle(ref, () => ({
    focus: () => {
      inputRef.current.focus()
    }
  }))

  return (
    <SelectAnt
      // suffixIcon={<CaretDownOutlined/>}
      ref={inputRef}
      {...restProps}
    >
      {children}
    </SelectAnt>
  )
})

export default Select